<template>
  <div>
    <el-table :data="tableData" border style="width: 100%">
    <el-table-column prop="shangPinName" label="商品名称"/>
    <el-table-column prop="shangPinPiCi" label="生产批次"/>
    <el-table-column prop="shangPinBaoZhi" label="保质期"/>
    <el-table-column prop="shangPinXuKe" label="生产许可证号"/>
    <el-table-column prop="shangPinQiYe" label="生产企业"/>
    <el-table-column label="操作">
      <template #default="{row}">
        <el-button @click="go(row)">详情</el-button>
      </template>
    </el-table-column>
  </el-table>
  </div>
</template>

<script setup lang="ts">
import axios from 'axios'
import { ref,onMounted,reactive } from 'vue'
import {ElMessage,ElMessageBox} from 'element-plus'
import { useRouter,useRoute } from 'vue-router'
const router = useRouter()
const route = useRoute()

//数据
const tableData=ref([])
const getList=()=>{
  axios.get('http://localhost:35582/api/Account/ShangPinShow').then(res=>{
    tableData.value=res.data.data
  }).catch(err=>{
    console.log(err);
  })
}

//跳转详情页
const go=(row:any)=>{
  router.push({
    name:"XinXi"
  })
}

//钩子函数
onMounted(()=>{
  getList();
})
</script>

<style scoped>

</style>